/**
 * author: zhou
 * date: 2017.10.19
 * description: 通用的请求方法集合
 * 
 */

// 引入redis
const   redis = require('../core/redis/redis'),
        redisPromise = require('../core/redis/redisPromise');

const common = {
    /**
     * 获取省市区信息
     * @param {*} ctx 
     */
    async getProvince(ctx) {
        const pipeline = redis.pipeline().get('location:data');
        const result = await redisPromise(ctx, pipeline);
        if (result) {
            ctx.body = { success: true, data: JSON.parse(result[0][1]), state: 200 };
        }
    }
};

module.exports = common;